Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
TypeError: .for is not iterable / array[Symbol.iterator]().next().value is not iterable

Given this code:

let arr = await fetch(...).then(r => r.json());
for(let [a, b] of arr) {
  console.log(a, b);
}

What could cause the cryptic/unhelpful error message .for is not iterable in Chromium/Node.js? On Firefox the error message is instead Uncaught TypeError: arr[Symbol.iterator]().next().value is not iterable.

This confused me for a few minutes so I figure until they make these error messages more friendly it'd be helpful to have an SO question/answer for it. See answer below.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This error occurs because the array contains non-arrays - e.g. it may contain objects like this:

let arr = [{a:1, b:2}, {a:3, b:4}];

So the for/of code should look like this instead:

for(let {a, b} of arr) {
  console.log(a, b);
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!